home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
DEV
/
I-Z
/
TransSkel.cpt
/
MultiSkel.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1987-01-08
|
4KB
|
145 lines
{ TransSkel multiple-window demonstration: main module}
{ This module performs setup and termination operations, installs}
{ the window and menu handlers, and processes menu item selections.}
{ There are four window handlers in this demonstration. The code}
{ for each handler is in its own module.}
{ Help Window Scrollable non-editable text window}
{ Edit Window Non-scrollable editable text window}
{ Zoom Window Non-manipulable graphics display window}
{ Region Window Manipulable graphics display window}
{ The project should include MacTraps,MacPasLib, TransSkelPas (or a project built}
{ from TransSkelPas), MSkelHelp.pas, MSkelEdit.pas, MSkelZoom.pas and}
{ MSkelRgn.pas. You'll also need the MultiSkel.globals and common.pas header files.}
{ 24 June 1986 Paul DuBois}
{ 8 January 1987 Ported to LightSpeed Pascal by Owen Hartnett }
{ Ωhm Software Company, 163 Richard Drive, Tiverton, RI 02878 }
PROGRAM MultiSkel;
USES
regionpas, MultiSkelGlobs, common, TransSkelpas, MSkelZoom, MultiSkelEdit, MSkelHelp;
{ file menu item numbers }
CONST
open = 1;
close = 2;
quit = 4;
{ Menu handles. There isn't any apple menu here, since TransSkel will}
{ be told to handle it itself.}
VAR
filemenu : menuhandle;
{ Handle selection of About MultiSkel… item from Apple menu}
PROCEDURE DoAbout;
VAR
ignore : integer;
BEGIN
ignore := Alert(aboutAlrt, NIL);
END;
{ Show a window if it's not visible. Select the window FIRST, then}
{ show it, so that it comes up in front. Otherwise it will be drawn}
{ in back then brought to the front, which is ugly.}
PROCEDURE MyShowWindow (wind : WindowPeek);
BEGIN
IF (wind^.visible = false) THEN
BEGIN
SelectWindow(WindowPtr(wind));
ShowWindow(WindowPtr(wind));
END;
END;
{ Process selection from File menu.}
{ Open Make all four windows visible}
{ Close Hide the frontmost window. If it belongs to a desk accessory,}
{ close the accessory.}
{ Quit Request a halt by calling SkelHalt(). This makes SkelMain}
{ return.}
PROCEDURE DoFile (item : integer);
VAR
wPeek : WindowPeek;
BEGIN
CASE item OF
open :
BEGIN
MyShowWindow(WindowPeek(rgnWind));
MyShowWindow(WindowPeek(zoomWind));
MyShowWindow(WindowPeek(editWind));
MyShowWindow(WindowPeek(helpWind));
END;
close :
{ Close the front window. Take into account whether it belongs}
{ to a desk accessory or not.}
BEGIN
wPeek := WindowPeek(FrontWindow);
IF wPeek <> NIL THEN
BEGIN
IF (wPeek^.windowKind < 0) THEN
CloseDeskAcc(wPeek^.windowKind)
ELSE
HideWindow(FrontWindow);
END;
END;
quit :
SkelWhoa; { request halt }
END;
END;
{ Process item selected from Edit menu. First check whether it should}
{ get routed to a desk accessory or not. If not, then for route the}
{ selection to the text editing window, as that is the only one for}
{ this application to which edit commands are valid.}
{ (The test of FrontWindow is not strictly necessary, as the Edit}
{ menu is disabled when any of the other windows is frontmost, and so}
{ this Proc couldn't be called.)}
PROCEDURE DoEdit (item : integer);
BEGIN
IF NOT SystemEdit(item - 1) THEN { check DA edit choice }
IF FrontWindow = editWind THEN
EditWindEditMenu(item);
END;
{ Initialize menus. Tell Skel to process the Apple menu automatically,}
{ and associate the proper procedures with the File and Edit menus.}
PROCEDURE SetUpMenus;
BEGIN
SkelApple('About MultiSkel...', @DoAbout);
fileMenu := GetMenu(fileMenuRes);
editMenu := GetMenu(editMenuRes);
SkelMenu(fileMenu, @DoFile, NIL);
SkelMenu(editMenu, @DoEdit, NIL);
END;
BEGIN
SkelInit;
SetUpMenus; { install menu handlers }
RgnWindInit; { install window handlers }
ZoomWindInit;
EditWindInit;
HelpWindInit;
SkelMain;
SkelClobber; { throw away windows and menus }
END.